package learning.numbers.pro;

import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.view.View;
import android.view.View.OnTouchListener;

public class LanguagePickActivity extends ListActivity{
	//TODO replace the list of buttons with two columns list with flags
	 static final String[] COUNTRIES = new String[] {  // List of countries
		 "Spanish",
		 "Macedonian"		 
	 };
	 
	OnTouchListener l;
	
	// For language compare
	public static final int SPANISH = 0;     
	public static final int MACEDONIAN = 1;
	
	public static int Country = 0;
	
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
	    
		// Fix screen 
		requestWindowFeature(Window.FEATURE_NO_TITLE);		        
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
        //TODO Replace with listview header?
        TextView tv = new TextView(this);        
        tv.setPadding(0, 20, 0, 20);
        tv.setText("Select language");
        tv.setGravity(Gravity.CENTER);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);
        tv.setLines(1);
        
        ListView lv = getListView();
        lv.addHeaderView(tv);
        lv.setDividerHeight(10);
        lv.setTextFilterEnabled(true);
        
        setListAdapter(new ArrayAdapter<String>(this, R.layout.language_button, COUNTRIES));    
                        
        final Intent i = new Intent(this,MainMenuActivity.class);
				

        lv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {
        	  Country =  position-1;
              startActivity(i);
        	  }        	           
        });
        
        
	}
	
}
